package com.example;

import com.example.bean.Product;
import com.example.bean.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
    public static void main(String[] args) {
   
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-beans.xml");

    
        Student student = (Student) context.getBean("student");

        Product product = context.getBean("product", Product.class);

        System.out.println("从IOC容器获取的Student：" + student);
        System.out.println("从IOC容器获取的Product：" + product);
    }
}